from typing import Generator
from .base import SessionLocal

def get_db() -> Generator:
    """
    获取数据库会话的生成器函数
    """
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close() 